//
//  BSLoginTextField.m
//  BaiSi
//
//  Created by Sycamore on 16/4/28.
//  Copyright © 2016年 Sycamore. All rights reserved.
//

#import "BSLoginTextField.h"
#import "UITextField+Placeholder.h"
@interface BSLoginTextField ()

@property (nonatomic,strong) UIColor *originColor;

@end

@implementation BSLoginTextField


- (void)awakeFromNib
{
    [self initialSetup];
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        //初始化操作
        [self initialSetup];
    }
    return self;
}

//初始化操作
- (void)initialSetup
{
    self.tintColor = [UIColor whiteColor];
    
    [self addTarget:self action:@selector(beginEdit) forControlEvents:UIControlEventEditingDidBegin];
    [self addTarget:self action:@selector(endEdit) forControlEvents:UIControlEventEditingDidEnd];
    

    UILabel *placeholderLabel = [self valueForKey:@"placeholderLabel"];
    _originColor = placeholderLabel.textColor;
}

//开始编辑
- (void)beginEdit
{
    self.placeholderColor = [UIColor whiteColor];
}

//结束编辑
- (void)endEdit
{
    
    self.placeholderColor = _originColor;
}


@end
